package com.ailk.tcm.activity;

import android.app.Fragment;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.ailk.tcm.R;
import com.ailk.tcm.R.array;
import com.ailk.tcm.R.drawable;
import com.ailk.tcm.R.id;
import com.ailk.tcm.R.menu;
import com.ailk.tcm.fragment.main.MainFragment1;
import com.ailk.tcm.fragment.main.MainFragment2;
import com.ailk.tcm.hffw.android.common.MyApplication;
import com.ailk.tcm.hffw.android.common.ui.activity.TabMenuActivity;

public class MainActivity extends TabMenuActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		MyApplication.getInstance().onActivityCreate(this);
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void onDestroy() {
		MyApplication.getInstance().onActivityDestroy(this);
		super.onDestroy();
	}

	@Override
	protected void onResume() {
		MyApplication.getInstance().onActivityResume(this);
		super.onResume();
	}

	@Override
	protected void onStop() {
		MyApplication.getInstance().onActivityStop(this);
		super.onStop();
	}

	@Override
	protected int[] getMenuImageResources() {
		return new int[]{
				R.drawable.ic_launcher,
				R.drawable.ic_launcher,
				R.drawable.ic_launcher,
				R.drawable.ic_launcher,
				R.drawable.ic_launcher
		};
	}

	@Override
	protected int[] getMenuFocusImageResources() {
		return new int[]{
				R.drawable.loading01,
				R.drawable.loading01,
				R.drawable.loading01,
				R.drawable.loading01,
				R.drawable.loading01
		};
	}

	@Override
	protected String[] getMenuTitles() {
		return getResources().getStringArray(R.array.main_menu_text);
	}

	@Override
	protected Class<? extends Fragment>[] getMenuFragmentClasses() {
		return new Class[]{
				MainFragment1.class,
				MainFragment2.class,
				MainFragment1.class,
				MainFragment2.class,
				MainFragment1.class
		};
	}
	
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

}
